# ---------------------------------------
# --- Awlsim
# --- LinuxCNC HAL configuration file
# ------

# --- Load the awlsim HAL userspace module ---
# Parameters:
#  --gui		: Enable/disable the GUI.
#			  The GUI should only be used for development and debugging
#			  purposes. In production the GUI should be disabled for
#			  performance reasons.
#  --input-base		: S7 input base-address byte-offset to use for the HAL module.
#			  If 0 is used, address-mapping will start at I 0.0
#			  If 1 is used, address-mapping will start at I 1.0
#			  etc...
#  --output-base	: S7 output base-address byte-offset to use for the HAL module.
#			  If 0 is used, address-mapping will start at Q 0.0
#			  If 1 is used, address-mapping will start at Q 1.0
#			  etc...
#  --input-size		: Size of the input area mapping, in bytes.
#  --output-size	: Size of the output area mapping, in bytes.
#  Last argument	: The S7 AWL/STL program to run.
loadusr -Wn awlsim awlsim-linuxcnc-hal --gui off --input-base 0 --input-size 32 --output-base 0 --output-size 32 /tmp/PROGRAM.awl

# --- Enable the used input pins ---
# All input pins are deactivated by default.
# So all input pins connected below, should be activated here by writing
# a '1' to the '.active' pin.
# Deactivated input pins will not be forwarded to the PLC program by awlsim.
setp	awlsim.input.bit.0.0.active		1
setp	awlsim.input.u32.4.active		1
setp	awlsim.input.s32.8.active		1
setp	awlsim.input.float.12.active		1

# --- Connect input pins ---
net	awlsim-in-bit-0-0	foobar.val0		=> awlsim.input.bit.0.0
net	awlsim-in-u32-4		foobar.val1		=> awlsim.input.u32.4
net	awlsim-in-s32-8		foobar.val2		=> awlsim.input.u32.8
net	awlsim-in-float-12	foobar.val3		=> awlsim.input.float.12

# --- Connect output pins --
net	awlsim-out-bit-0-0	awlsim.output.bit.0.0	<= bizbaz.val0
net	awlsim-out-u32-4	awlsim.output.u32.4	<= bizbaz.val1
net	awlsim-out-s32-8	awlsim.output.s32.8	<= bizbaz.val2
net	awlsim-out-float-12	awlsim.output.float.12	<= bizbaz.val3
